package com.zhongfl.crm.service.impl;

import com.zhongfl.crm.mapper.LxRevisitLogCommentMapper;
import com.zhongfl.crm.model.LxRevisitLogComment;
import com.zhongfl.crm.model.vo.LxRevisitLogCommentVO;
import com.zhongfl.crm.service.LxRevisitLogCommentService;
import org.springframework.stereotype.Service;
import tech.heptagram.staff.cas.common.AssertUtils;

import javax.annotation.Resource;
import java.util.List;

/**
 * 跟进记录评论 服务实现类
 *
 * @author 奈良鹿丸
 * @date 2018/9/21
 */
@Service
public class LxRevisitLogCommentServiceImpl implements LxRevisitLogCommentService {

    @Resource
    private LxRevisitLogCommentMapper lxRevisitLogCommentMapper;

    @Override
    public void deleteById(Long id) {
        AssertUtils.notNull(id, "励销跟进评论ID为空");
        lxRevisitLogCommentMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void insertLxRevisitLogComment(LxRevisitLogComment record) {
        AssertUtils.notNull(record, "励销跟进评论为空");
        lxRevisitLogCommentMapper.insert(record);
    }

    @Override
    public LxRevisitLogComment findLxRevisitLogCommentById(Long id) {
        AssertUtils.notNull(id, "励销跟进评论ID为空");
        return lxRevisitLogCommentMapper.selectByPrimaryKey(id);
    }

    @Override
    public void updateLxRevisitLogCommentById(LxRevisitLogComment record) {
        AssertUtils.notNull(record, "励销跟进评论为空");
        AssertUtils.notNull(record.getId(), "励销跟进评论ID为空");
        lxRevisitLogCommentMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<LxRevisitLogCommentVO> findLxRevisitLogCommentByParentRevisitLogId(Long parentRevisitLogId) {
        List<LxRevisitLogCommentVO> lxRevisitLogCommentVOs = lxRevisitLogCommentMapper.selectLxRevisitLogCommentByParentRevisitLogId(parentRevisitLogId);
        return lxRevisitLogCommentVOs;
    }
}
